import numpy as np
import csv
def fiveNumber(nums):
    # 五数概括 Minimum（最小值）、Q1、Median（中位数、）、Q3、Maximum（最大值）
    Minimum = min(nums)
    Maximum = max(nums)
    Q1 = np.percentile(nums, 25)
    Median = np.median(nums)
    Q3 = np.percentile(nums, 75)
    return Minimum, Q1, Median, Q3, Maximum
reader=csv.reader(open("../Wine Reviews/dataset/winemag-data_first150k.csv","r",encoding="utf-8"))
datas=[[] for _ in range(2)]
for row in reader:
    for i in range(2):
        if len(row[i+4])>0:
            datas[i].append(row[i+4])
for i in range(2):
    datas[i]=list(map(float,datas[i][1:]))
    print(fiveNumber(datas[i]))


